package bestbuy;
import java.util.ArrayList;
import java.util.Date;



public class Receipt implements ReceiptInterface{

	private StoreHeader header;
	private Date saleDate;
	private ArrayList<PurchaseItem> items = new ArrayList<PurchaseItem>();
	private double totalSale;
	private double amountDue;
	
	
	public Receipt() {
		header = new StoreHeader();
		saleDate = new Date();
		
		items.add(new PurchaseItem("Orange Juice", 4.75, 1));
		items.add(new PurchaseItem("Ice Cream", 5, 2));
		items.add(new PurchaseItem("Bread", 3.15, 1));
		items.add(new PurchaseItem("American Cheese", 1.50, 1));
		items.add(new PurchaseItem("Tostitos", 2.85, 1));
	}
	
	public Receipt(PurchaseItem item) {
		header = new StoreHeader();
		saleDate = new Date();
		
		items.add(new PurchaseItem("Orange Juice", 4.75, 1));
		items.add(new PurchaseItem("Ice Cream", 5, 2));
		items.add(new PurchaseItem("Bread", 3.15, 1));
		items.add(new PurchaseItem("American Cheese", 1.50, 1));
		items.add(new PurchaseItem("Tostitos", 2.85, 1));
		items.add(item);
	}
	
	public Date getSaleDate () {
		return saleDate;
	}
	
	public String getItems() {
		String returnMe = "";
		for (int i=0; i<items.size(); i++) {
			totalSale = totalSale + (items.get(i).getCost());
			returnMe = returnMe + "\n" + items.get(i).getPurchaseItem();
		}
		return returnMe;
	}
	
	public String getReceipt() {
		return header.getHeader() + "\n" + saleDate + "\n" + getItems() + "\n\nTotal Sale: $" + totalSale + "\nAmount Due: $" + amountDue + "\n";
	}
	
	
	private class StoreHeader {
		private String storeName;
		private String address;
		private String phoneNumber;
		private int storeNumber;
		
		public StoreHeader() {
			storeName = "Best Buy";
			address = "1717 York Rd Timonium, MD 21093";
			phoneNumber= "(888) 229-3770";
			storeNumber= 1;
		}
		
		public StoreHeader(String storeName, String address, String phoneNumber, int storeNumber) {
			this.storeName=storeName;
			this.address=address;
			this.phoneNumber=phoneNumber;
			this.storeNumber=storeNumber;
		}
		
		public String getHeader() {
			return "\n" + storeName + "\n" + address + "\n" + phoneNumber + "\nStore Number: " + storeNumber + "\n";
		}
	}
	
	private class SalesTax {
		
	}
}